import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// import vueDevTools from 'vite-plugin-vue-devtools'
// import { templateCompilerOptions } from '@tresjs/core'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    // vueDevTools(),
    vue({
      // ...templateCompilerOptions
    }),
  ],
  server: {
    port: 80,
    host: true,
    proxy: {
      '/api': {
        target: 'http://localhost:7001',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    },
  },
  resolve: {
    // 配置路径别名
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
      '@m': fileURLToPath(new URL('./srcm', import.meta.url)),
      '@b': fileURLToPath(new URL('./', import.meta.url))
    },
  }
})
